import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      name: 'ready',
      component: () => import('@/views/ReadyView.vue')
    },
    {
      path: '/settings',
      name: 'settings',
      component: () => import('@/views/SettingsView.vue')
    },
    {
      path: '/',
      component: () => import('@/components/layout/MainLayout.vue'),
      children: [
        {
          path: 'home',
          name: 'home',
          component: () => import('@/views/HomeView.vue')
        },
        {
          path: 'note',
          name: 'note',
          component: () => import('@/views/NoteView.vue')
        }
      ]
    }
  ]
})

export default router

window.bnote.menus.onSetting(() => {
  router.push('/settings')
})
